package com.scm.export;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;

import org.apache.log4j.Logger;

public class DownloadSCM {

	 private static Logger log = Logger.getLogger(DownloadSCM.class);
	
	 public static void downloadFromUrl(String url, String outputFile) throws IOException {
		 	log.info("Url:"+url+" outputFile:"+outputFile);
			URL urlObject = new URL(url);
			InputStream is = urlObject.openStream();
			OutputStream os = new FileOutputStream(outputFile);
			byte[] b = new byte[2048];
			int length;
			while ((length = is.read(b)) != -1) {
				os.write(b, 0, length);
			}
			is.close();
			os.close();
		}

}
